home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / ARASAN_S.ZIP / TIMECTRL.CPP < prev    next >
C/C++ Source or Header  |  1994-08-09  |  1KB  |  64 lines

  1. // Copyright 1994 by Jon Dart.
  2.  
  3. #include "timectrl.h"
  4. #ifdef WINDOWS
  5. #include <windows.h>
  6. #else
  7. #include <stdio.h>
  8. #define wsprintf sprintf
  9. #endif
  10.  
  11. Time_Control::Time_Control()
  12. {
  13.    Search_Limit lim;
  14.    lim.max_ply = 2;
  15.    limits = lim;
  16.    srctype = Fixed_Ply;
  17. }
  18.  
  19. Time_Control::Time_Control(Search_Type typ, Search_Limit lim)
  20. {
  21.    limits = lim;
  22.    srctype = typ;
  23. }
  24.  
  25. const char *Time_Control::Image() const
  26. {
  27.      static char msg[40];
  28.      switch (get_search_type())
  29.      {
  30.         case 0: /* Fixed_Ply */
  31.        wsprintf(msg,"%d ply",limits.max_ply);
  32.        break;
  33.        case 1: /* Time_Limit */
  34.            wsprintf(msg,"%ld seconds/move",
  35.          limits.seconds);
  36.        break;
  37.        case 2: /* Game */
  38.            wsprintf(msg,"game in %d minutes",
  39.          limits.limit.minutes);
  40.        break;
  41.        case 3: /* Tournament */
  42.            wsprintf(msg,"%d moves/%d minutes",
  43.          limits.limit.moves,limits.limit.minutes);
  44.  
  45.      }
  46.      return msg;
  47. }
  48.  
  49. Time_Info::Time_Info()
  50. :Time_Control(),
  51.  period(0),
  52.  last_time_control(0),
  53.  bonus(0)
  54. {
  55. }
  56.  
  57. Time_Info::Time_Info(Search_Type t, Search_Limit lim)
  58. :Time_Control(t,lim),
  59.  period(0),
  60.  last_time_control(0),
  61.  bonus(0)
  62. {
  63. }
  64.